#ifndef SOCKET_H_
#define SOCKET_H_
#include <string>
#include <string.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <netdb.h>

class Socket {
private:
	int fdSocket;
	bool activo;
	unsigned long obtenerIP(const char* host) const;
	Socket(const Socket &s);
	explicit Socket(int fd);

public:
	Socket();
	virtual ~Socket();
	int listen(int puerto, int cantidadCliente);
	Socket* accept();
	bool estaActivo();
	int recv(char* buf, int size);
	bool recvToString(std::string& buffer);
	int send(const void* buffer, int size);
	int shutdown();
	void close();
	bool connect(const std::string &host, unsigned int puerto);
};

#endif
